//@ts-ignore忽略当前文件ts类型的检测否则有红色提示(打包会失败)
import { createApp } from 'vue'
import App from '@/App.vue'

// 引入pinia
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'

// 路由的引入
import router from '@/router'
import './permission'

import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import 'element-plus/theme-chalk/dark/css-vars.css' // 暗黑模式

// svg插件配置代码
import 'virtual:svg-icons-register'

// 引入scss样式
import '@/styles/index.scss';

// 全局组件的引入
import MyComponent from '@comp/index.ts'

const app = createApp(App)

const pinia = createPinia()

app.use(ElementPlus, {
    locale: zhCn
})

app.use(router)
app.use(pinia)
pinia.use(piniaPluginPersistedstate)
// 清空pinia仓库数据支持
pinia.use(({ store }) => {
    const initialState = JSON.parse(JSON.stringify(store.$state));
    store.$reset = () => {
        store.$patch(initialState);
    }
})

app.use(MyComponent)

app.mount('#app')
